#ifndef ROOM_H
#define ROOM_H

#include "qtlibs.h"
#include "entitie.h"
#include "user.h"
#include "message.h"

class Message;

class Room : public Entitie {
public:
    Room(QString ownerIdentify, QString roomName);
    QString getOwnerIdentify();
    QString getName();
    QString getDescription();
    QList<User*> getModerators();
    QList<User*> getUsers();

    bool getPassNeed();
    QString getPassHash();
    void setPass(QString passHash);
    void setDescription(QString description);
    void setOwnerIdentify(QString identify);
    void addModerator(User* user);
    void removeModerator(User* user);
    void addUser(User* user);
    void removeUser(User* user);

    bool isModerator(User* user);
    bool isOwner(User* user);
    bool isMember(User* user);

    QList<Message*> getMessages(int limit);
    void addMessage(Message* message);


protected:
    QString ownerIdentify;
    QString name;
    QString description;

    bool needPass;
    QString passHash;

    QList<User*> moderators;
    QList<User*> users;
    QList<Message*> messages;
};

#endif // ROOM_H
